<?php
require "utility.php";

$conn = connect_mysql();
$query_str = "SELECT DISTINCT category FROM Book ORDER BY category;";
$query = $conn->query($query_str);
$raw_data = $query->fetch_all();
header("Content-Type: application/json");
echo json_encode(array_map(function ($v){
    return $v[0];
}, $raw_data), JSON_UNESCAPED_UNICODE);

$query->close();
$conn->close();